#ifndef CAR_H
#define CAR_H

#include "PlayState.h"
#include "Vec3.h"
#include "NonCopyable.h"
#include "EventHandler.h"
#include "GlmMesh.h"
#include "Wheel.h"

class Car : public NonCopyable, public EventHandler
{
private:
	Car();
	friend class Singleton<Car>;

public:
	void Update();
	void Draw();
	bool Load(const std::string& mainMeshName, const std::string& tyreName);
	void Unload();
	void OnKeyboardEvent(const SDL_KeyboardEvent& event);
	virtual void OnJoystickAxisEvent(const SDL_JoyAxisEvent& event);

	Vec3f& GetPos();
	Vec3f& GetVel();

	void SetPos(const Vec3f& pos);
	void SetVel(Vec3f vel);
	void Direction();

private:
	Vec3f		m_pos;
	Vec3f		m_vel;
	float		m_angle;
	float		m_acc;
	float		m_rotVel;
	bool		m_keyBoardMovingUp;
	bool		m_keyBoardMovingDown;
	bool		m_keyBoardRotating;
	
	float		m_speedPressed;
	bool		m_moving;
	bool		m_rotating;
	
	GlmMesh		m_wheels[4];
	Vec3f		m_wheelTransforms[4];
	
	GlmMesh		m_car;
	//GlmMesh		m_flWheel;

};

typedef Singleton<Car> TheCar;

#endif